package com.janko.springbootbase.a_projectExample.collection.set;

import java.util.Objects;

/**
 * @Author janko
 * @Version 1.0
 * @date 2021/5/16 1:29
 * @Description 类文件说明
 */
public class SetPerson {
    int age;
    String name;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        SetPerson setPerson = (SetPerson) o;
        return age == setPerson.age &&
                name.equals(setPerson.name);
    }

    @Override
    public int hashCode() {
        return Objects.hash(age, name);
    }

    public SetPerson(int age, String name) {
        this.age = age;
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return "SetPerson{" +
                "age=" + age +
                ", name='" + name + '\'' +
                '}';
    }
}
